/*
 * Copyright (c) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import {XMLDOMErrorHandler} from'./XMLDOMErrorHandler.js';
import {XMLDOMStringList} from'./XMLDOMStringList.js';

// export function XMLDOMConfiguration() {
  function XMLDOMConfiguration() {
    var clonedSelf;
    this.defaultParams = {
      "canonical-form": false,
      "cdata-sections": false,
      "comments": false,
      "datatype-normalization": false,
      "element-content-whitespace": true,
      "entities": true,
      "error-handler": new XMLDOMErrorHandler(),
      "infoset": true,
      "validate-if-schema": false,
      "namespaces": true,
      "namespace-declarations": true,
      "normalize-characters": false,
      "schema-location": '',
      "schema-type": '',
      "split-cdata-sections": true,
      "validate": false,
      "well-formed": true
    };
    this.params = clonedSelf = Object.create(this.defaultParams);
  }

  Object.defineProperty(XMLDOMConfiguration.prototype, 'parameterNames', {
    get: function() {
      return new XMLDOMStringList(Object.keys(this.defaultParams));
    }
  });

  XMLDOMConfiguration.prototype.getParameter = function(name) {
    if (this.params.hasOwnProperty(name)) {
      return this.params[name];
    } else {
      return null;
    }
  };

  XMLDOMConfiguration.prototype.canSetParameter = function(name, value) {
    return true;
  };

  XMLDOMConfiguration.prototype.setParameter = function(name, value) {
    if (value != null) {
      return this.params[name] = value;
    } else {
      return delete this.params[name];
    }
  };

//   return XMLDOMConfiguration;

// }
export { XMLDOMConfiguration }